package com.hanamaki.method;

import java.util.Scanner;

/**
 * ctrl + shift + +/-
 */
public class Demo08 {

    public static void main(String[] args) {
        calc();
    }


    //编写计算器方法
    public static void calc() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入第一个运算数字：");
        int a = scanner.nextInt();
        System.out.println("请输入运算符号：");
        String op = scanner.next();
        System.out.println("请输入第一个运算数字：");
        int b = scanner.nextInt();
        switch (op) {
            case "+":
                add(a, b);
                break;
            case "-":
                less(a, b);
                break;
            case "*":
                multiply(a, b);
                break;
            case "/":
                except(a, b);
                break;
            default:
                System.out.println("输入错误");
        }
    }

    // 创建一个计算器，实现加减乘除
    public static void add(int a, int b) {
        System.out.println(a + b);
    }

    public static void less(int a, int b) {
        System.out.println(a - b);
    }

    public static void multiply(int a, int b) {
        System.out.println(a * b);
    }

    public static void except(int a, int b) {
        System.out.println(a / b);
    }


}
